/**
 * 
 */
package aiproject3.models;

import java.util.HashMap;

/**
 * @author Chris
 *
 */
public class Unigram implements KnowledgeBase<Character, Integer> {

	private HashMap<Character, Integer> _data;
	
	public Unigram() {
		_data = new HashMap<Character, Integer>();
	}
	
	
	public void addToModel(Character unit) {
		if (_data.containsKey(unit)) {
			_data.put(unit, _data.get(unit) + 1);
		} else {
			_data.put(unit, 1);
		}		
	}

	
	public boolean contains(Character unit) {
		return _data.containsKey(unit);
	}

	
	public Integer getValueFromModel(Character unit) {
		return _data.get(unit);
	}

	
	public int getNumUnits() {
		return _data.keySet().size();
	}

}
